import { Module } from '@nestjs/common';
import { GraphQLModule } from '@nestjs/graphql';
import { TypeOrmModule } from '@nestjs/typeorm';
import { Owner } from './owners/entities/owner.entity';
import { OwnersModule } from './owners/owners.module';
import { Product } from './products/entities/product.entity';
import { ProductsModule } from './products/products.module';

@Module({
  imports: [
    GraphQLModule.forRoot({
      installSubscriptionHandlers: true,
      autoSchemaFile: 'schema.gql',
    }),
    TypeOrmModule.forRoot({
      type: 'postgres',
      host: 'localhost',
      port: 5432,
      username: 'liuchenyu',
      password: 'Shirase-1423l',
      database: 'local-postgres',
      schema: 'public',
      entities: [Owner, Product],
    }),
    OwnersModule,
    ProductsModule,
  ],
  controllers: [],
  providers: [],
})
export class AppModule {}
